home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / ftp / gui-ftp / rexx / windowsnt.filter < prev   
Text File  |  1998-05-24  |  2KB  |  80 lines

  1. /* REXX */
  2. /*
  3. ** An ARexx script to convert Windows NT listings to a format that Gui-FTP
  4. ** can understand.
  5. **
  6. ** The input file has the format:
  7. **
  8. ** <DATE> <TIME> <TYPE> <SIZE> <NAME>
  9. **
  10. ** <DATE> is MM-DD-YY
  11. ** <TIME> is HH:MMxx   (xx = AM or PM as appropriate)
  12. ** <TYPE> is '<DIR>' for a directory, blank otherwise
  13. ** <SIZE> is the size of the file in bytes, blank for a directory
  14. ** <NAME> is the files name.
  15. **
  16. ** for example,
  17. **
  18. ** 10-26-94 07:37AM  <DIR>           Earth
  19. ** 10-26-94 10:24PM            3274  IAMS.TXT
  20. **
  21. ** The output file has the format usually produced by the Unix 'ls' command
  22. ** 'ls -lgA', i.e.
  23. **
  24. ** <flags> <dirs> <user> <group> <size> <DD MMM YYYY> <name>
  25. **
  26. ** drwxrwxrwx  2 kev      users          1024 01 Jan 1994  ADir
  27. ** -rw-r--r--  1 kev      users         16524  5 Aug 01:23 ThisIsAFile
  28. **
  29. ** The script MUST read from STDIN and write to STDOUT.  It will be passed
  30. ** each line of data exactly as received by Gui-FTP.  The file must write
  31. ** one line of data for each file in the input stream, i.e. this script is
  32. ** responsible for handling multi-data lines and merging them into a single
  33. ** line.
  34. */
  35.  
  36. MONTHS.1  = "Jan"
  37. MONTHS.2  = "Feb"
  38. MONTHS.3  = "Mar"
  39. MONTHS.4  = "Apr"
  40. MONTHS.5  = "May"
  41. MONTHS.6  = "Jun"
  42. MONTHS.7  = "Jul"
  43. MONTHS.8  = "Aug"
  44. MONTHS.9  = "Sep"
  45. MONTHS.10 = "Oct"
  46. MONTHS.11 = "Nov"
  47. MONTHS.12 = "Dec"
  48.  
  49. do until eof( STDIN )
  50.     parse pull T$
  51.     if ~ eof( STDIN ) then do
  52.         if T$ > "" then do
  53.             SIZE = word( T$, 3 )
  54.             if SIZE > "" then do
  55.                 DATE = word( T$, 1 )
  56.                 MM   = substr( DATE, 1, 2 )
  57.                 DD   = substr( DATE, 4, 2 )
  58.                 YY   = substr( DATE, 7, 2 )
  59.                 CC   = "19"
  60.                 if YY > 95 then do
  61.                     CC = "20"
  62.                 end
  63.                 DATE = " " || MONTHS.MM || " " || DD || " " || CC || YY || "  "
  64.                 if SIZE = "<DIR>" then do
  65.                     DIR  = "d"
  66.                     SIZE = 0
  67.                 end
  68.                 else do
  69.                     DIR = "-"
  70.                 end
  71.                 OUTLINE = DIR || "rwxrwxrwx  1 nobody   nobody   " || right( SIZE, 8 ) || DATE || WORD( T$, 4 )
  72.                 say OUTLINE
  73.             end
  74.         end
  75.     end
  76. end
  77.  
  78. exit 0
  79.  
  80.